package com.delivery.controller.user;

import com.delivery.entity.Category;
import com.delivery.result.Result;
import com.delivery.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController("user.CategoryController")
@RequestMapping("/user/category")
public class CategoryController {

    @Autowired
    CategoryService categoryService;

    @GetMapping("/list")
    public Result<List<Category>> queryByType(Integer type) {
        // 分类类型：1菜品分类 2套餐分类
        List<Category> categories = categoryService.findCategoriesByType(type);
        return Result.success(categories);
    }
}
